
///视频接入
function xcspjrClick(){
	var path = $("#tianminPath").val();
	if(path=="")
		return;
	var shell= new ActiveXObject("wscript.shell"); 
	var cmdStr = "cmd.exe   /c start "+"\"\" ";
	shell.run(cmdStr+"\""+path+"\"");
}

///////////////视频采集/////////////////////////
//对话框模糊查询灾害点
function getYJDCDForZhdByKeyword(){
	var keyword = $("#hscjrkZhdmc").val();
	var url = "getZhdByKeyword.shtml";
	var obj = {keyword:keyword};
	if(keyword!=""){
		$.post(url,obj,getYJDCDCallbackForZhd);
	}
}

function getYJDCDCallbackForZhd(res){
	if(res!=""){
		$("#hscjrkZhdxz").html("");
		res = eval(res);
		var str1 = '<option value="" selected="selected">--请选择--</option>';
		$("#hscjrkZhdxz").append(str1);
		for(var i = 0;i<res.length;i++){
			var str = "";
			var type = top.getOperTypeZhdByCode(res[i].biaoshi);
			str = "<option value='"+res[i].id+"&"+res[i].biaoshi+"'>"+res[i].name+"("+type+")</option>";
			$("#hscjrkZhdxz").append(str);
		}
		$("#hscjrkZhdxz").change(function(){
			$("#hscjrkZhdmc").attr("value",res[$("#hscjrkZhdxz").attr("selectedIndex")-1].name).attr("title",$("#hscjrkZhdxz").val());
		});
	}
}



function hsspcjQuding(){
	var zhdbh = $("#hscjrkZhdmc").attr("title").split("&")[0];
	var zhdBiaoshi = $("#hscjrkZhdmc").attr("title").split("&")[1];
	if(zhdbh==""){
		alert("请您在右边的列表中选择灾害点!");
		return;
	}
	var time = $("#hscjrkTime").val();
	var zlmc = $("#hscjrkZlmc").val();
	var zllb = $("#hscjrkZllb").val();
	var spPath = $("#spPath").val();
	var arr = spPath.split(".");
	var spFileType  = "";
	if(arr.length>0){
		spFileType = arr[arr.length-1];
	}else{
		alert("请您选择有后缀名的文件!");
		return;
	}
	if(time==""||zlmc==""||zllb==""||spPath==""){
		alert("请您将表单填写完整!");
		return;
	}
	var actionUrl = "insertHscjrk.shtml?time="+time+"&zhdBiaoshi="+zhdBiaoshi+"&zlmc="+zlmc+"&zllb="+zllb+"&zhdbh="+zhdbh+"&spFileType="+spFileType;
	$("#yjhsFrom").attr("action",actionUrl);
	$("#yjhsFrom").submit(function () {
        // 提交表单
        $(this).ajaxSubmit();
        // 为了防止普通浏览器进行表单提交和产生页面导航（防止页面刷新？）返回false
        return false;
    });
    $('#yjhsFrom').ajaxSubmit(function (res) {
    	if(res.length>4){
   		 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
     		var hiddenDiv = $("<div>");
     		hiddenDiv.html(res);
     		res = hiddenDiv.text();
   		}
    	if(res=="true"){
    		alert("采集成功！");
    	}else{
    		alert("采集失败！");
    	}
    });
}

function hsspcjQuxiao(){
	$("#hscjrkZhdmc").val("");
	$("#hscjrkZhdxz").html("");
	$("#hscjrkTime").val("");
	$("#spPath").val("");
}

/////////////////查询回放////////////////////////////////////
function initHscxTable(){
	$("#hscxTable").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : '1_jbqk0110',
					title : '灾害点名称',
					width : 150,
					align : 'center',
					editor : 'text'
				},{
					field : '0_jbqk0102',
					title : '灾害点标识',
					width : 150,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						
						var name = rec[0].jbqk0102;
						var showStr = top.getOperTypeZhdByCode(name);
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ showStr
								+"</div>";
						return resutsHTML;
					}
				},{
					field : '0_yjhs05200',
					title : '会商开始时间',
					width : 150,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjhs05220',
					title : '资料名称',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : 'oper',
					title : '操作',
					width : 120,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						//curRecObj = rec;
						var yjhs05 = rec[0];
						var leibie = yjhs05.yjhs05210;
						var spName = yjhs05.yjhs05300;
						var resultsHTML = "";
						if(leibie.substring(0,2)=="SP"&&spName!=""){
							resultsHTML = "<div style='align:center;'>"
								+"<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='bofangHSSp(\""
								+ spName
								+ "\",false)'>播放</a>"
								+"</div>";
						}else{
							resultsHTML = "没有视频";
						}
						return resultsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
	});
}


function queryHscxFunction(){
	var shen = $("#hscxShen").val();
	var shi = $("#hscxShi").val();
	var xian = $("#hscxXian").val();
	var areaCode = handlerAreaFunc(shen,shi,xian);
	var zhlx = $("#hscxZHLX").val();
	var zhCode = "";
	if(zhlx==""){
		zhCode = handlerZhCodeFunc(areaCode);
	}else{
		zhCode = handlerZhCodeFunc(areaCode,zhlx);
	}
	var sTime = $("#hscxStartTime").val();
	var eTime = $("#hscxEndTime").val();
	var zlmc = $("#hscxZlmc").val();
	var obj = {
			zhCode:zhCode,
			sTime:sTime,
			eTime:eTime,
			zlmc:zlmc
	};
	var url = "queryHszl.shtml";
	$('#hscxTable').datagrid({
		url : url,
		queryParams : obj,
		onLoadSuccess : function(res) {
		},
		onLoadError : function(res) {
			alert("查询失败!");
		}
	});	
}

function bofangHSSp(spName){
		if(spName!=null)
			window.open("../hsspPlay.jsp?url="+spName);
}